import allure
from selenium.webdriver.common.by import By

from base.base import Base


class PageRegister(Base):
    #输入手机号
    @allure.step("1、输入手机号")
    def __page_input_phone(self,phone):
        self.element_send_keys((By.CSS_SELECTOR,"#username"),phone)    #输入验证码
    @allure.step("2、输入验证码")
    def __page_input_verify_code(self,verify_code):
        self.element_send_keys((By.CSS_SELECTOR,"input[placeholder='图像验证码']"),verify_code)
    #输入密码
    @allure.step("3、输入密码")
    def __page_input_password(self,password):
        self.element_send_keys((By.CSS_SELECTOR,"#password"),password)
    #输入确认密码
    @allure.step("4、输入确认密码")
    def __page_input_confirm_password(self,password):
        self.element_send_keys((By.CSS_SELECTOR,"#password2"),password)

    #输入推荐人手机号
    @allure.step("5、输入推荐人手机号")
    def __page_input_recommend_phone(self,phone):
        self.element_send_keys((By.CSS_SELECTOR,"input[placeholder='请输入手机号码'][name='invite']"),phone)

    #点击注册按钮
    @allure.step("6、点击注册按钮")
    def __page_click_register_btn(self):
        self.element_click((By.CSS_SELECTOR,".regbtn.J_btn_agree"))
    def page_register(self,phone,code,password,password2,  recommend_phone):
        self.__page_input_phone(phone)
        self.__page_input_verify_code(code)
        self.__page_input_password(password)
        self.__page_input_confirm_password(password2)
        self.__page_input_recommend_phone(recommend_phone)
        self.__page_click_register_btn()



